package com.itheima.mapper.admin;

import com.itheima.pojo.admin.Setmeal;
import com.itheima.pojo.admin.SetmealDish;
import com.itheima.pojo.admin.SetmealRelation;
import com.itheima.pojo.client.SelectSetmealByCategoryIdAndStatusVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author ChenJunJie
 * @date 2022/6/13 16:19
 * 分类的mapper层
 */
@Mapper
public interface SetmealMapper {

    //新增套餐
    int setmealAdd(Setmeal<SetmealDish> setmeal);

    //新增套餐与套餐菜品关系
    int setmealRelationAdd(@Param("setmealId") String setmealId ,@Param("dish")SetmealDish dish);

    //套餐分页查询
    List<Setmeal<SetmealDish>> setmealPagination(@Param("name") String name ,@Param("page")Integer page,@Param("pageSize")Integer pageSize);

    //通过名字查询套餐
    List<Setmeal<SetmealDish>> setmealSelectByName(@Param("name") String name);

    //通过套餐id查询套餐
    Setmeal setmealSelectById(@Param("id") String id);

    //通过套餐id查询关系
    List<SetmealRelation> setmealRelationSelectById(@Param("id") String id);

    //通过套餐id修改套餐
    int setmealUpdateById(Setmeal<SetmealDish> setmeal);

    //通过套餐id删除关系
    int setmealDishDeleteById(@Param("id") String id);

    //通过套餐id删除套餐
    int setmealDeleteById(@Param("id") String id);

    //通过套餐id修改套餐状态
    int setmealUpdateStatusById(@Param("status") Integer status ,@Param("id") String id);

    //通过菜品id查询关系
    List<SetmealDish> setmealDishSelectById(@Param("id") String id);

    //通过分类id查询套餐
    List<Setmeal<SetmealDish>> setmealSelectByCategoryId(@Param("id") String id);

    //通过分类id与状态查询套餐
    List<SelectSetmealByCategoryIdAndStatusVo> selectSetmealByCategoryIdAndStatus(@Param("categoryId") String categoryId, @Param("status") Integer status);
}
